var app = getApp();

Page({
    data: {
        hidden3: !1,
        hidden4: !0,
        button: !0,
        cash_zhi2: !1,
        cash_zhi: !1,
        tx_cost: 0
    },
    onLoad: function(t) {
        var a = this;
        app.setNavigationBarColor(this), wx.hideShareMenu(), app.util.request({
            url: "entry/wxapp/getSystem",
            cachetime: "0",
            success: function(t) {
                console.log("这是系统设置"), console.log(t), a.setData({
                    system: t.data
                });
            }
        }), a.reload();
    },
    reload: function(t) {
        var a = this;
        app.getUserInfo(function(t) {
            console.log(t), a.setData({
                user_id: t.id
            }), app.util.request({
                url: "entry/wxapp/MyIncome",
                data: {
                    user_id: t.id
                },
                success: function(t) {
                    console.log(t), a.setData({
                        money: t.data.money
                    });
                }
            }), 0 == t.rz_type && wx.showModal({
                title: "温馨提示",
                content: "您还没有进行认证，无法提现，点击确定进行认证",
                success: function(t) {
                    t.confirm ? (console.log("用户点击确定"), wx.redirectTo({
                        url: "../authentication/authentication"
                    })) : t.cancel && (console.log("用户点击取消"), wx.navigateBack({
                        delta: 1
                    }));
                }
            });
        });
    },
    bindblur: function(t) {
        var a = this.data.system.tx_sxf, o = t.detail.value, e = o * (a / 100), n = o - e;
        n = n.toFixed(2), e = e.toFixed(2), this.setData({
            tx_cost: o,
            sxf: e,
            sj_cost: n
        });
    },
    formSubmit: function(t) {
        var a = this;
        console.log(t), console.log(a.data);
        var o = Number(a.data.system.zd_money), e = a.data.sj_cost, n = (a.data.sxf, Number(a.data.money)), s = t.detail.value.name, c = a.data.tx_cost, i = t.detail.value.account_number, u = t.detail.value.account_number_two, l = a.data.user_id, d = "";
        "" == c || c <= 0 ? d = "请输入提现金额" : n < c ? d = "不能超过可提现金额" : c < o ? d = "没有到提现门槛" : "" == s ? d = "请输入姓名" : "" == i ? d = "请输入微信账号" : "" == u ? d = "请再次输入微信账号" : i != u && (d = "账号输入有误，请重述"), 
        "" != d ? wx.showModal({
            title: "温馨提示",
            content: d
        }) : app.util.request({
            url: "entry/wxapp/savetx",
            data: {
                name: s,
                user_id: l,
                tx_cost: c,
                sj_cost: e,
                account: u
            },
            success: function(t) {
                console.log(t), 1 == t.data && wx.navigateBack({
                    delta: 1
                });
            }
        });
    },
    inform: function(t) {
        wx.navigateTo({
            url: "inform?status=2"
        });
    },
    onReady: function() {},
    onShow: function() {
        console.log(this.data);
    },
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {}
});